package com.alittle.core.view;

import android.view.View;


/**
 * Toolbar上的伪菜单项
 */

public final class V4FrameActionMenu {

    public static final int INVALID_RES_ID = 0;

    private boolean enable = true;//是否可用
    private String content;//文字内容
    private String contentDescription;//内容描述(在只有图标的情况下,用来说明图标作用,支持盲人操作)
    private int leftResId = INVALID_RES_ID;//左侧图标
    private int rightResId = INVALID_RES_ID;//右侧图标
    private View.OnClickListener clickListener;//菜单单击

    /**
     * 构造方法太多,还是直接使用set方法吧,而且也不像去写个Builder了.
     */
    @Deprecated
    private V4FrameActionMenu(int leftResId, String content, int rightResId, String contentDescription, View.OnClickListener clickListener) {
        this.leftResId = leftResId;
        this.content = content;
        this.rightResId = rightResId;
        this.contentDescription = contentDescription;
        this.clickListener = clickListener;
    }

    /**
     * 构造方法太多,还是直接使用set方法吧,而且也不像去写个Builder了.
     */
    @Deprecated
    public V4FrameActionMenu(int leftResId, String content, View.OnClickListener clickListener) {
        this(leftResId, content, INVALID_RES_ID, null, clickListener);
    }

    /**
     * 构造方法太多,还是直接使用set方法吧,而且也不像去写个Builder了.
     */
    @Deprecated
    public V4FrameActionMenu(String content, int rightResId, View.OnClickListener clickListener) {
        this(content, rightResId, null, clickListener);
    }

    /**
     * 构造方法太多,还是直接使用set方法吧,而且也不像去写个Builder了.
     */
    @Deprecated
    public V4FrameActionMenu(String content, View.OnClickListener clickListener) {
        this(INVALID_RES_ID, content, INVALID_RES_ID, null, clickListener);
    }

    /**
     * 构造方法太多,还是直接使用set方法吧,而且也不像去写个Builder了.
     */
    @Deprecated
    public V4FrameActionMenu(int leftResId, String content, String contentDescription, View.OnClickListener clickListener) {
        this(leftResId, content, INVALID_RES_ID, contentDescription, clickListener);
    }

    /**
     * 构造方法太多,还是直接使用set方法吧,而且也不像去写个Builder了.
     */
    @Deprecated
    public V4FrameActionMenu(String content, int rightResId, String contentDescription, View.OnClickListener clickListener) {
        this(INVALID_RES_ID, content, rightResId, contentDescription, clickListener);
    }

    /**
     * 构造方法太多,还是直接使用set方法吧,而且也不像去写个Builder了.
     */
    @Deprecated
    public V4FrameActionMenu(String content, String contentDescription, View.OnClickListener clickListener) {
        this(INVALID_RES_ID, content, INVALID_RES_ID, contentDescription, clickListener);
    }

    public V4FrameActionMenu(String content) {
        content(content);
    }

    public String getContentDescription() {
        return contentDescription;
    }

    public int getLeftResId() {
        return leftResId;
    }

    public int getRightResId() {
        return rightResId;
    }

    public String getContent() {
        return content;
    }

    public View.OnClickListener getClickListener() {
        return clickListener;
    }

    public boolean isEnable() {
        return enable;
    }

    public V4FrameActionMenu leftResId(int leftResId) {
        this.leftResId = leftResId;
        return this;
    }

    public V4FrameActionMenu rightResId(int rightResId) {
        this.rightResId = rightResId;
        return this;
    }

    public V4FrameActionMenu content(String content) {
        this.content = content;
        return this;
    }

    public V4FrameActionMenu contentDescription(String contentDescription) {
        this.contentDescription = contentDescription;
        return this;
    }

    public V4FrameActionMenu click(View.OnClickListener clickListener) {
        this.clickListener = clickListener;
        return this;
    }

    public V4FrameActionMenu enable(boolean enable) {
        this.enable = enable;
        return this;
    }
}
